package com.zxlspace.thread;

public class JoinDemo1 extends Thread {
    public static void main(String[] args) throws InterruptedException {
        JoinDemo1 joinDemo1 = new JoinDemo1();
        Thread t = new Thread(joinDemo1); //新生
        t.start(); //就绪
        //cpu 调度 运行

        for (int i=0; i<1000; i++) {
            if (i==50) {
                t.join(); //main 阻塞, 合并join线程
            }
            System.out.println("main....." + i);
        }
     }

    @Override
    public void run() {
        super.run();
        for(int i=0;i<1000;i++){
            System.out.println("join...."+i);
        }
    }
}
